﻿using System;
using System.Data;
using System.Web;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using AnyOffice.Components;
using AnyOffice.DAL;
using AnyOffice.Model;
namespace AnyOffice.general.system.user_priv
{
    public partial class clone : ModulePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                int num = (Request.QueryString["priv_id"] != null) ? Convert.ToInt32(Request.QueryString["priv_id"].ToString()) : 0;
                this.ViewState["PrivId"] = num;
            }
            if (this.Page.IsPostBack)
            {
                UserPrivDao dao = new UserPrivDao();
                UserPrivData data = new UserPrivData();
                data.PrivNo = Convert.ToInt32(this.txtPrivNo.Text);
                data.PrivName = this.txtPrivName.Text;
                DataTable table = dao.SelectByPrivId(base.Conn, Convert.ToInt32(this.ViewState["PrivId"].ToString()));
                if ((table.Rows.Count > 0) && (table.Rows[0]["FuncIdStr"] != DBNull.Value))
                {
                    data.FuncIdStr = table.Rows[0]["FuncIdStr"].ToString();
                }
                dao.Insert(base.Conn, data);
                this.pnlMain.Visible = false;
                this.lblMessage.Text = base.ShowPrompt("新建角色成功!", "index.aspx");
            }

        }
    }
}
